<%@page import="java.util.Date"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/classes/DBHelper.class.jsp"%>
<%@ include file="/classes/CommonHelper.class.jsp"%>
<%
	String guid = getParameter(request,"guid");
	if(nullOrEmpty(guid)){
		%>
		<script type="text/javascript">
			alert("参数错误！");
			history.go(-1);
		</script>
		<%
		return;
	}
	String title = getParameter(request,"title");
	String content = getParameter(request,"content");
	String status = getParameter(request,"status");
	String dept_code = getParameter(request,"dept_code");
	String jzsj = getParameter(request,"jzsj");  
	String kssj = getParameter(request,"kssj");
	//站点
	String website_code = getParameter(request,"website_code");
	if(nullOrEmpty(title) || nullOrEmpty(content) || nullOrEmpty(status) || nullOrEmpty(dept_code) || nullOrEmpty(website_code)){
		%>
		<script type="text/javascript">
			alert("请检查您提交的数据是否完整！");
			history.go(-1);
		</script>
		<%
		return;
	}
	
	//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	//String date = sdf.format(new Date());
	Date date = new Date();
	List<Object> params = new ArrayList<Object>();
	String sql ="update app_myzj_info set create_time=to_date('"+kssj+"','YYYY-MM-DD'),guid = ? ";
	if(!nullOrEmpty(jzsj)){
		sql = "update app_myzj_info set create_time=to_date('"+kssj+"','YYYY-MM-DD'),end_time=to_date('"+jzsj+"','YYYY-MM-DD'),guid = ? ";
	}
	params.add(guid);
	if(!nullOrEmpty(title)){
		sql += " ,title = ?";
		params.add(title);
	}  
	
	if(!nullOrEmpty(content)){
		sql += " ,content = ?";
		params.add(content);
	}
	
	if(!nullOrEmpty(status)){
		sql += " ,status = ?";
		params.add(status);
	}
	
	if(!nullOrEmpty(dept_code)){
		sql += " ,dept_code = ?";
		params.add(dept_code);
	}
	
	if(!nullOrEmpty(website_code)){
		sql += " ,website_code = ?";
		params.add(website_code);
	}
	
	sql += " where guid = ?";      
	params.add(guid);  
	
	int count = executeUpdate(sql,params);
	
	if(count>0){
		%>       
		<script type="text/javascript">
			alert("操作成功");
			window.location.href = "myzj_list.jsp?r=<%=new Date().getTime()%>";
			//window.close();
		</script>
		<%
		return;
	}else{  
		%>
		<script type="text/javascript">     
			alert("操作失败2");
			history.go(-1);
		</script>
		<%
		return;
	}
	
	
	
%>